var config = require('../../../config.js')
var http = require('../../../utils/httpHelper.js')
Page({
  data: {
    sex:'',
    noSave:true
  },
  //事件处理函数
  onLoad: function () {
    var that = this;
    let userInfo = wx.getStorageSync('user');
    that.setData({sex:userInfo.sex});
  },
  radioChange:function(e){
    let userInfo = wx.getStorageSync('user');
    var val = e.detail.value;
    var data = {userId:userInfo.userId,sex:val}
    http.httpPutForm(config.clubApi.putSex,data,function(res){
      if(res.code == '200') {
        userInfo.sex = val;
        wx.setStorageSync('user', userInfo);
        wx.navigateBack();
        console.log("修改性别成功");
      }else {
        console.log("修改性别失败");
      }
    });
  }
})